]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
status/power: Init the proxy asynchronously
authorRui Matos <tiagomatos@gmail.com>
Mon, 28 Jan 2013 15:38:45 +0000 (16:38 +0100)
committerRui Matos <tiagomatos@gmail.com>
Mon, 28 Jan 2013 16:35:02 +0000 (17:35 +0100)
Blocking the compositor is evil!

https://bugzilla.gnome.org/show_bug.cgi?id=692715

js/ui/status/power.js

index 619b02b30833924c81910e16a291664cfd6b5d13..d5b2de08e1c18b4242cb0eb213040e7259aa1081 100644 (file)
@@ -54,7 +54,16 @@ const Indicator = new Lang.Class({
     _init: function() {
         this.parent('battery-missing-symbolic', _("Battery"));
 
-        this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH);
+        this._proxy = new PowerManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH,
+                                           Lang.bind(this, function(proxy, error) {
+                                               if (error) {
+                                                   log(error.message);
+                                                   return;
+                                               }
+                                               this._proxy.connect('g-properties-changed',
+                                                                   Lang.bind(this, this._devicesChanged));
+                                               this._devicesChanged();
+                                           }));
 
         this._deviceItems = [ ];
         this._hasPrimary = false;
@@ -70,10 +79,6 @@ const Indicator = new Lang.Class({
 
         this.menu.addMenuItem(new PopupMenu.PopupSeparatorMenuItem());
         this.menu.addSettingsAction(_("Power Settings"), 'gnome-power-panel.desktop');
-
-        this._proxy.connect('g-properties-changed',
-                            Lang.bind(this, this._devicesChanged));
-        this._devicesChanged();
     },
 
     _readPrimaryDevice: function() {